import { Body, ClassSerializerInterceptor, Controller, Get, Inject, Post, Query, Req, UseInterceptors } from '@nestjs/common';
import { FeishuService } from './feishu.service';
import { Public } from '@/common/decorators/public.decorator';
import { RedisService } from '@/common/redis/redis.service';
import { RedisKeyEnum } from '@/common/enums/redis-key.enum';
import { DailyRoutineDto } from './dto/daily-routine.dto';
import { Request } from 'express';
import { TUser } from '@/@types/common';


@Controller('feishu')
export class FeishuController {
  constructor(private readonly feishuService: FeishuService) { }

  @Get('getSheetAllData')
  async getSheetAllData(@Req() req: Request) {
    return await this.feishuService.getDailyDataByDate(req.user as TUser)
  }

  /** 获取当前日期打卡完成度 */
  @Get('checkTodayRoutine')
  async checkTodayRoutine(@Req() req: Request, @Query('date') date: string) {
    return await this.feishuService.checkTodayRoutine(req, date);
  }


  /** 日常打卡记录 */
  @Post('dailyRoutine')
  async dailyRoutine(@Body() dailyRoutine: DailyRoutineDto, @Req() req: Request) {
    return await this.feishuService.dailyRoutine(dailyRoutine, req);
  }



}
